package com.javaweb.admin.controller;

import com.javaweb.admin.entity.KdlSineGoodsmovementDto;
import com.javaweb.admin.entity.KdlSineSoOutbound;
import com.javaweb.admin.entity.KdlSineSoOutboundDto;
import com.javaweb.admin.query.KdlSineGoodsmovementQuery;
import com.javaweb.admin.query.KdlSineSoOutboundQuery;
import com.javaweb.admin.service.IKdlSineSoOutboundService;
import com.javaweb.common.annotation.Log;
import com.javaweb.common.enums.LogType;
import com.javaweb.common.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/kdlsinesooutbound")
public class KdlSineSoOutboundController {
    @Autowired
    private IKdlSineSoOutboundService kdlSineSoOutboundService;

    @GetMapping("/index")
    public JsonResult index(KdlSineSoOutboundQuery query) {
        return kdlSineSoOutboundService.getOutBoundList(query);
    }

    @GetMapping("/detail")
    public JsonResult detail(KdlSineSoOutboundQuery query) {
        return kdlSineSoOutboundService.getDetailList(query);
    }


    @Log(title = "信谊销毁订单指令", logType = LogType.INSERT)
    @PostMapping("/create")
    public JsonResult create(@RequestBody KdlSineSoOutboundDto dto) {
        return kdlSineSoOutboundService.create(dto);
    }

    @Log(title = "信谊下发移库指令", logType = LogType.UPDATE)
    @PutMapping("/update")
    public JsonResult update(@RequestBody KdlSineSoOutboundDto dto) {
        return kdlSineSoOutboundService.update(dto);
    }

    @Log(title = "信谊下发移库指令", logType = LogType.DELETE)
    @DeleteMapping("/delete/{id}")
    public JsonResult delete(@PathVariable("id") Integer id  ) {
        return kdlSineSoOutboundService.deleteById(id);
    }


}
